package com.zzty.txj.controller;


import com.zzty.txj.entity.Daily;
import com.zzty.txj.entity.DoDaily;
import com.zzty.txj.entity.User;
import com.zzty.txj.entity.UserDaily;
import com.zzty.txj.service.DailyService;
import com.zzty.txj.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/daily")
public class PostController {
    @Autowired
    PostService postService;
    @RequestMapping(value="postCard")
    public List<Daily> getDaily(){

        return postService.getDaily();
    }

   // @RequestMapping(value="count")
    public String getCount(User user){
        String count=postService.getCount(user);
        count=count.replaceAll(",","");

//        int c=Integer.parseInt(count);
//        System.out.println("c"+c);
        char a[]=count.toCharArray();
        String name;
        for(int i=0;i<count.length();i++){

            String b=String.valueOf(a[i]);
            int d=Integer.valueOf(b);

            name=postService.getName(d);

        }
        return count;
    }

}
